<!-- 好友列表 -->
<template>
  <!-- 好友列表 盒子开始 -->
  <div id="FriendList">
    <div class="FriendsLetter" :class="[letter]">
      {{letter}}
    </div>
    <div class="FriendsList">
      <div class="FriendsMain BoxActive" @click="gotoDetails(Friend.friendId)" v-for="(Friend,index) in data" :key='index' :id="Friend.friendId">
        <img alt="" :src="Friend.pic" />
        <div class="FriendName overflow">{{Friend.remark}}</div>
      </div>
    </div>
  </div>
  <!-- 好友列表 盒子结束 -->
</template>

<script>
name:'FriendList'
export default {
  data(){
   return{}
  },
  props:['data','letter'],
  methods:{
    /**
    * 向父组件传递事件方法，
    * 子组件传递事件：gotoDetails(){'this.$emit('GotoDetails')'}
    * 父组件接收事件：<Head v-on:GotoDetails="GotoDetails"></Head>
    * 父组件定义事件：GotoDetails(){console.log(1)}
    */
    gotoDetails(id) {
      //添加（圆圈带加号）
      this.$emit("gotoDetailsClick",id);
    },
  },
}
</script>
  
<style scoped lang="less">
  .FriendsLetter{
    height: 60px;
    line-height: 60px;
    padding: 0 30px;
    color: #8c8c8c;
  }
  .FriendsList{
    background: #fff;
    .FriendsMain{
      padding-left:30px;
      height: 110px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      img{
        width: 80px;
        height: 80px;
      }
      .FriendName{
        height: 109px;
        width: 570px;
        padding-right: 30px;
        line-height: 109px;
        border-bottom: 1px solid #e8e8e8;
      }
      &:last-child div{
        border-bottom: 0px;
        height: 110px;
      }
    }
  }
</style>
